@extends('admin.master')

@section('title','管理员列表')

@section('css')
    <!--dynamic table-->
    <link href="{{asset('admin/assets/js/advanced-datatable/css/demo_page.css')}}" rel="stylesheet" />
    <link href="{{asset('admin/assets/js/advanced-datatable/css/demo_table.css" rel="stylesheet')}}" />
    <link rel="stylesheet" href="{{asset('admin/assets/js/data-tables/DT_bootstrap.css')}}" />
@endsection

@section('content')
    <!-- page heading start-->
    <div class="page-heading">
        <ul class="breadcrumb">
            <li>
                <a href="{{ url('back/index') }}">后台首页</a>
            </li>
            <li>
                <a href="{{ url('back/category/form') }}">添加父类</a>
            </li>
            <li class="active">管理员列表</li>
        </ul>
    </div>
    <!-- page heading end-->

    <!--body wrapper start-->
    <div class="wrapper">
        <div class="row">
            <div class="col-sm-12">
                <section class="panel">
                    <header class="panel-heading">
                        <span class="tools pull-right">
                        <a href="javascript:;" class="fa fa-chevron-down"></a>
                        <a href="javascript:;" class="fa fa-times"></a>
                    </span>
                        <span class="tools pull-left"><input type="text" class="form-control" placeholder="Search" name="keywords" value="{{$request['keywords'] or ''}}"/></span><span>  &nbsp;搜索框</span>
                    </header>
                    <div class="panel-body">
                        <div class="adv-table">
                            <div class="table-responsive">
                                <table  class="table table-striped">
                                    <tr>
                                        {!! Form::open(['url' => 'back/category/edit','method' => 'post']) !!}
                                        {{ csrf_field() }}
                                        <td class="text-center">{!! Form::button('<i class="fa fa-times"></i>'.'添加顶级分类'.'<i class="fa fa-times"></i>',['class' => 'form-control']) !!}</td>
                                        <td class="text-center">{!! Form::text('title','',['placeholder'=> '请输入要添加的顶级类目名称','class' => 'form-control']) !!}</td>
                                        <td class="text-center">{!! Form::button('<i class="fa fa-check"></i>',['class' => 'btn btn-lg btn-login btn-block','type' => 'submit']) !!}</td>
                                        <td class="text-center">{!! Form::button('<i class="fa fa-times"></i>',['class' => 'btn btn-lg btn-login btn-block','type' => 'reset']) !!}</td>
                                        {!! Form::close() !!}
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </div>
                    <div class="table-responsive">
                        <table  class="table table-bordered table-striped">
                            <thead>
                            <tr>
                                <th class="text-center">分类编号</th>
                                <th class="text-center">分类名称</th>
                                <th class="text-center">分类id</th>
                                <th class="text-center">路径</th>
                                <th class="text-center">添加</th>
                                <th class="text-center">删除</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach($data as $key1 => $value1)
                                <tr>
                                    <td class="text-center">{{$value1['attributes']['id']}}</td>
                                    <td class="text-center">{{$value1['attributes']['title']}}</td>
                                    <td class="text-center">{{$value1['attributes']['parentid']}}</td>
                                    <td class="text-center">{{$value1['attributes']['path']}}</td>
                                    <td class="text-center"><a href="javascript:;"><i class="glyphicon glyphicon-remove" name='iii' data-toggle="modal" data-target="#myModal" data-id="{{$value1['attributes']['id']}}">{{$value1['attributes']['id']}}</i></a></td>
                                    <td class="text-center"><a href="delete/{{ $value1['attributes']['id'] }}"><i class="glyphicon glyphicon-remove"></i></a></td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                        <div class="row-fluid">
                            <div class="dataTables_paginate paging_bootstrap pagination">{!! $data->appends($request)->render() !!}</div>
                        </div>



                        <!-- Modal -->

                        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                            {{--{!! Form::open(['url' => '','method' => 'post','id' => 'form-fix']) !!}--}}
                            <form action="{{url('back/category/edit/')}}" method="post" id="form-fix">
                                {{ csrf_field() }}
                                <div class="modal-dialog">
                                    <div class="modal-content">
                                        <div class="modal-header">
                                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                            <h4 class="modal-title" id="myModalLabel">添加子类</h4>
                                        </div>
                                        <div class="modal-body">
                                            <input type="text" class="form-control"/>
                                        </div>
                                        <div class="modal-footer">
                                            <button type="submit" class="btn btn-default">确认</button>
                                            <button type="reset" class="btn btn-primary">重置</button>
                                        </div>
                                    </div><!-- /.modal-content -->
                                </div><!-- /.modal-dialog -->
                                {{--{!! Form::close() !!}--}}
                            </form>
                        </div><!-- /.modal -->


                    </div>
                </section>
            </div>
        </div>
    </div>
    <!--body wrapper end-->
    <!--footer section start-->
    <footer>
        2014 &copy; AdminEx by <a href="http://www.bookfrank.cn/" target="_blank">源码之家</a>
    </footer>
    <!--footer section end-->
@endsection

@section('js')
    <!--dynamic table-->
    <script type="text/javascript" language="javascript" src="{{asset('admin/assets/js/advanced-datatable/js/jquery.dataTables.js')}}"></script>
    <script type="text/javascript" src="{{asset('admin/assets/js/data-tables/DT_bootstrap.js')}}"></script>
    <!--dynamic table initialization -->
    <script src="{{asset('admin/assets/js/dynamic_table_init.js')}}"></script>
    <script type="text/javascript">
    </script>
@endsection